//q2b.cpp
//The program gets amount of numbers set by the user and print their numeric average and geo average.
//
//Binyamin 22 december 2017
//-----------------------------------------------------------
#include <iostream>
#include <math.h>

using namespace std;

// 1. Prompt for numbers
// 2. store their value.
// 3. calculate numeric average and geo average.
// 4. print numeric average and geo average.

int main()
{
	int num; // num - the current number the user insert.
	int sum; // sum - the numeric sum of the numers.
	int int_count; // int_count - the amount of non negative numbers.
	int pow_sum; // pow_sum - the sums of the power of the numbers.
	int pow_count; // pow_count - counting the numbers who are greater than 0.
	double average; // average - the numeric average for the numbers.
	double gaverage; // gaverage - the geo average for the numbers.

	//initilization
	sum = 0;
	int_count = 0;
	pow_sum = 0;
	pow_count = 0;
	
	cout << "Please enter numbers, to stop enter -1" << endl;
	cin >> num;
	while(num != -1)
	{
		if(!(num<0))
		{
			sum += num;
			int_count++;
			if(num>0)
			{
				pow_sum += pow(num,2);
				pow_count++;
			}
		}
		cin >> num;
	}
	if(int_count > 0)
	{
		average = sum / int_count;
		cout << "The numeric average is " << average << endl;
	}
	else // int_count <= 0
	{
		cout << "No non negative number were enterered" << endl;
	}
	if(pow_count > 0)
	{
		gaverage = pow(pow_sum, 1/pow_count);
		cout << "The geometric average is " << gaverage << endl;
	}
	else // pow_count <= 0
	{
		cout << "No numbers greater than 0 were entered" << endl;
	}


	return 0;
}
//output
//Please enter numbers, to stop enter -1
//No non negative number were enterered
//No numbers greater than 0 were entered
